import React from 'react';
import './EditorView.scss';
import EditorContainer from "./EditorContainer/EditorContainer";
import {PopupWindowType} from "../../data/PopupWindowType";
import {AppState} from "../../store";
import {connect} from "react-redux";
import classNames from "classnames";
import TopNavigationBar from "./TopNavigationBar/TopNavigationBar";

interface IProps {
    activePopupType: PopupWindowType;
}

const EditorView: React.FC<IProps> = ({activePopupType}) => {

    const getClassName = () => {
        return classNames(
            "EditorView",
            {
                "withPopup": !!activePopupType
            }
        );
    };

    return (
        <div className={getClassName()}>
            <TopNavigationBar/>
            <EditorContainer/>
        </div>
    );
};

const mapStateToProps = (state: AppState) => ({
    activePopupType: state.general.activePopupType
});

export default connect(
    mapStateToProps
)(EditorView);